<template>
  <div>
    <FilterTable ref="table" :height="250" :columns="columns" :dataSource="dataSource" :onColumnsChange="columns => (this.columns = columns)"></FilterTable>
    <div class="btn-wrap">
      <el-button type="primary" @click="okBtnClick">确定</el-button>
      <el-button type="primary" @click="cancelBtnClick">取消</el-button>
    </div>
  </div>
</template>

<script>
import { getRepairImportXm } from '@/api/repair/business/customer/repairImport.js';
export default {
  name: '',
  props: {
    vin: {
      type: String,
      required: true
    }
  },
  data() {
    return {
      columns: [
        {
          title: '序号',
          sorter: true,
          dataIndex: 'index',
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        {
          title: '项目代码',
          dataIndex: 'LABOUR_CODE',
          sorter: true
        },
        {
          title: '项目名称',
          sorter: true,
          dataIndex: 'LABOUR_NAME'
        },
        {
          title: '行管项目代码',
          sorter: true,
          dataIndex: 'LOCAL_LABOUR_CODE'
        },
        {
          title: '行管项目名称',
          sorter: true,
          dataIndex: 'LOCAL_LABOUR_NAME'
        },
        {
          title: '标准工时',
          sorter: true,
          dataIndex: 'STD_LABOUR_HOUR'
        },
        {
          title: '工时单价',
          sorter: true,
          dataIndex: 'LABOUR_AMOUNT'
        },
        {
          title: '派工工时',
          sorter: true,
          dataIndex: 'ASSIGN_LABOUR_HOUR'
        },
        {
          title: '备注',
          sorter: true,
          dataIndex: 'REMARK'
        }
      ],
      dataSource: []
    };
  },
  mounted() {
    this.getRepairImportXm();
  },
  methods: {
    // 查询维修项目 表格数据
    async getRepairImportXm() {
      const vin = this.vin;
      const params = {
        sort: 'LABOUR_CODE',
        order: 'asc',
        limit: 10,
        offset: 0,
        advice_labour: '',
        dmsFuncId: 35100010,
        _: new Date().getTime()
      };
      const res = await getRepairImportXm(vin, params);
      /*
      {
        "ASSIGN_LABOUR_HOUR": 0.3,
        "DEALER_CODE": "CK180183",
        "LABOUR_AMOUNT": 165,
        "LABOUR_CODE": "02344AT/301",
        "LABOUR_CODEF": "02344AT",
        "LABOUR_NAME": "面板—侧饰板—进入或更换—一个 两个",
        "LABOUR_PRICE": 550,
        "LOCAL_LABOUR_CODE": null,
        "LOCAL_LABOUR_NAME": null,
        "MODEL_LABOUR_CODE": null,
        "OEM_LABOUR_HOUR": 0.3,
        "REMARK": null,
        "STD_LABOUR_HOUR": 0.3,
        "SUGGEST_MAINTAIN_LABOUR_ID": 21,
        "VER": 0,
        "WORKER_TYPE_CODE": null
        }
      */
      this.dataSource = res.rows;
    },
    okBtnClick() {},
    cancelBtnClick() {}
  }
};
</script>

<style lang="less" scoped>
.btn-wrap {
  display: flex;
  height: 60px;
  justify-content: center;
  align-items: center;
}
</style>
